package com.edu.security;

import lombok.Getter;
import lombok.Setter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Set;

/*
用户安全信息类
1.继承Security的User类（不要导错包）
2.设置一个User属性（我们自己写的User）
3.编写一个有参的构造器
4.创建User并给User赋值
 */
public class UserSecurity extends User {
    @Getter
    @Setter
    private com.edu.entity.User user;
    public UserSecurity(com.edu.entity.User user, Set<GrantedAuthority> authorities) {

        super( user.getUsername(), user.getPassword(), true,true,true,true, authorities);
        this.user = user;
    }
}
